<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<span th:text="${#strings.isEmpty(name) ? '空' : name}"></span>

<span th:if="${#strings.isEmpty(name)}" th:text="空"/>
<span th:if="${!#strings.isEmpty(name)}" th:text="${name}"/>

</body>
</html>